/*****************************************************************************
*    Copyright (C)2006 Ali Corporation. All Rights Reserved.
*
*    File:    tun_tda18212.h
*
*    Description:    Header file of THOMSON DTT7596 TUNER.
*    History:
*           Date            Athor        Version          Reason
*	    ============	=============	=========	=================
*	1.  3.16.2007		PengHui	Ver 0.1	 Create file.
*****************************************************************************/

#ifndef __TUN_TDA18212_H__
#define __TUN_TDA18212_H__

#include <types.h>
#include <hld/nim/nim_tuner.h>

  
#ifdef __cplusplus
extern "C"
{
#endif

#define	SEM_SOK  	    0                   /* OK */ 
#define	SEM_SFALSE	    1                   /* No errors, but function returned negative result */ 
#define	SEM_SPENDING	    1                   /* Function needs once more to be called.*/
                                                /*  Look the function's documentation for more details */ 
 
#define SEM_ERROR           (0x80000000) 
#define	SEM_EFAIL	    (0x80000000)   /* Function failed by unknown reason */ 
 
#define	SEM_EBAD_UNIT_NUMBER (0x80000100)  /* NIM number is out of range */ 
#define	SEM_ENOT_INITIALIZED (0x80000200)  /* xxxx_init() function wasn't called for this front-end unit */ 
#define	SEM_EBAD_PARAMETER   (0x80000400)  /* One of function's input parameter has invalid value */ 
#define	SEM_ENOT_SUPPORTED   (0x80000800)  /* Some feature asked by caller is not supported */ 
                                                /* Look the function's documentation for more details */ 
 
#define	SEM_EIIC_ERR        (0x80001000)   /* While interacting with NIM module some I2C bus error happened.*/  
                                                /*  ( SDA/SCL problem, etc...) */ 
#define	SEM_EI2C_ERR        SEM_EIIC_ERR   	/* IIC==I2C */ 
 
#define	SEM_EIIC_NOACK      (0x80002000)   /* While interacting with NIM module no ACK bit) */ 
 
#define	SEM_ETIMEOUT        (0x80004000)   /* Some timeout limit. Look the function's documentation for more details.*/ 
 
#define	SEM_ESMALL          (0x80008000)   /* This function needs more bigger struct (newer struct) */ 
 
#define	SEM_EOUT_OF_MEMORY  (0x80010000)    



INT32 tun_tda18212_init(UINT32 *tuner_id, struct COFDM_TUNER_CONFIG_EXT * ptrTuner_Config);
INT32 tun_tda18212_control(UINT32 tuner_id, UINT32 freq, UINT8 bandwidth,UINT8 AGC_Time_Const,UINT8 *data,UINT8 _i2c_cmd);	
INT32 tun_tda18212_status(UINT32 tuner_id, UINT8 *lock);


/**  
 * ISDBT  
 */  
static UINT8   
_ary_init_isdbt[]=  
{  
#if 0
    0x05,0x01, 
    0x30,0x4D, 
    0x25,0x60, 
    0x0E,0x32, 
    0x1E,0xF8, 
    0x1F,0x00, 
    0x36,0x1C, 
    0x24,0x49, 
    0x26,0x00, 
    0x27,0x00, 
    0x28,0x00, 
    0x29,0x00, 
    0x2A,0x00, 
    0x2B,0x00, 
    0x22,0x3D, 
    0x37,0x48, 
    0x0A,0x00, 
    0x06,0x00, 
    0x14,0x43, 
    0x19,0x41, 
    0x1A,0x01,  
 //   0xFF,0xFF  
#else //v1.03.002
    0x36, 0x0C, 
    0x23, 0x03, 
    0x24, 0x49, 
    0x2E, 0x40, 
    0x06, 0x00, 
    0x0A, 0x8C, 
    0x0C, 0x00, 
    0x0D, 0x0F, 
    0x0E, 0xF2, 
    0x0F, 0x5C, 
    0x10, 0x0B, 
    0x11, 0x4B, 
    0x12, 0x02, 
    0x13, 0x20, 
    0x14, 0x07, 
    0x15, 0x41, 
    0x1B, 0x60, 
    0x19, 0x3B, 
    0x1A, 0x01, 
#endif
};  


  
static UINT8   
_ary_isdbt_6mhz_vh[]=  
{ 
#if 0
    0x06,0x00, 
    0x0C,0x00, //agc1_top
    0x0D,0x0F, 
    0x0E,0x32, //agck
    0x0F,0x5B, //rf_agc
    0x10,0x0B, //agc4_top
    0x11,0x0B, //agc5_top
    0x12,0x03, //if level
    0x13,0xA1, //if filter
    0x14,0x43, //ref clk
    0x15,0x50, //if freq
    0x1B,0x60, //psm
    0x23,0x01, //ir mixer
    0x25,0x60, //agc_5
    0x0A,0x80,  //irq clear
    //0xFF,0xFF  //bidden
#else
    0x0F,0x5B,  
    0x15,0x41, 
    0x0A,0x8C, 
    0x06,0x00, 
    0x14,0x47, 
#endif
};  

int array_6mhz_vh_Size = sizeof(_ary_isdbt_6mhz_vh) / sizeof(UINT16);

static UINT8   
_ary_isdbt_6mhz_uhf[]=  
{
#if 0
    0x06,0x00, 
    0x0C,0x00, 
    0x0D,0x0F, 
    0x0E,0x32, 
    0x0F,0x5C, 
    0x10,0x0B, 
    0x11,0x0B, 
    0x12,0x03, 
    0x13,0xA1, 
    0x14,0x43, 
    0x15,0x50, 
    0x1B,0x60, 
    0x23,0x01, 
    0x25,0x60, 
    0x0A,0x80,  
 //   0xFF,0xFF  
#else
    0x0F,0x5C,  
    0x15,0x41,  
    0x0A,0x8C,  
    0x06,0x00,  
    0x14,0x47,  
#endif
};  


#ifdef __cplusplus
}
#endif

#endif  /* __TUN_tda18212_H__ */






